//#ifndef WATERPROGRESSBAR_H
//#define WATERPROGRESSBAR_H

//#include <QWidget>

//class WaterProGressBar
//{
//public:
//    WaterProGressBar();
//};

//#endif // WATERPROGRESSBAR_H
#ifndef WATERPROGRESSBAR_H
#define WATERPROGRESSBAR_H

#include <QWidget>
class QColor;
class WaterProgressBar : public QWidget//继承QWidget
{
    Q_OBJECT
public:
    explicit WaterProgressBar(QWidget *parent = nullptr);

    void setVaule(double value);
    void setColor(int r,int g,int b,int brightness);
    void setUint(QString uint);
public slots:
    void updaterWater();//定时更新，让波浪动起来

protected:
    void paintEvent(QPaintEvent *event) override;//自绘控件
    //实现左右拖动改变value
//    void mousePressEvent(QMouseEvent *event) override;
//    void mouseReleaseEvent(QMouseEvent *event) override;
//    void mouseMoveEvent(QMouseEvent *event) override;

private:
    int m_value;
    double md_value;
    qreal m_offset;

    bool m_isPressed;
    QPoint m_startPoint;
    QColor color;
    QString uint;

    void drawWater(QPainter* painter);//画水波浪
    void drawText(QPainter* painter);//画中间数值
    void drawBg(QPainter* painter);//画背景
};

#endif // WATERPROGRESSBAR_H
